$(function() {
    $(".del").each(function() {
        $(this).click(function(event) {
            event.preventDefault();
            var url = $(this).attr('href');
            bootbox.confirm({
                title: "系统提示",
                message: "是否要删除该卡券",
                callback: function(result) {
                    if (result) {
                        window.location.href = url;
                    }
                },
                buttons: {
                    "cancel": {
                        "label": "取消"
                    },
                    "confirm": {
                        "label": "确定",
                        "className": "btn-danger"
                    }
                }
            });
        });
    });

    var $overflow ='';
    var colorbox_params = {
        rel: 'colorbox',
        reposition:false,
        scalePhotos:true,
        scrolling:false,
        loop:false,
        // previous:'<i class="ace-icon fa fa-arrow-left"></i>',
        // next:'<i class="ace-icon fa fa-arrow-right"></i>',
        close:'&times;',
        current:'{current} of {total}',
        maxWidth:'100%',
        maxHeight:'100%',
        onOpen:function(){
            $overflow = document.body.style.overflow;
            document.body.style.overflow = 'hidden';
        },
        onClosed:function(){
            document.body.style.overflow = $overflow;
        },
        onComplete:function(){
            $.colorbox.resize();
        }
    };

    $('[data-rel="colorbox"]').colorbox(colorbox_params);
})